home *** CD-ROM | disk | FTP | other *** search
- Path: colossus.holonet.net!russell
- From: russell@news.mdli.com (Russell Blackadar)
- Newsgroups: comp.lang.c++
- Subject: Re: dynamic memory allocation
- Date: 1 Feb 1996 22:40:26 GMT
- Organization: HoloNet National Internet Access System: 510-704-1058/modem
- Message-ID: <4erfgq$2n2@colossus.holonet.net>
- References: <310ABD89.5537@gnomic.stanford.edu> <DM0G35.AKr@news.arco.com> <4er1tt$jnm@rolaids.frco.com>
- NNTP-Posting-Host: jubal.mdli.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Jim Adam (Jadam@tcmail.frco.com) wrote:
-
- : Actually, I think it has to be:
-
- : void *& p // "POINTER REFERENCE"
- ...
-
- : It's weird, but the operators appear in opposite order
- : of the way you would normally pronounce them....
-
- It's not really weird. It's an example of a general rule in
- C declarations -- to find out the type, start at the variable
- name, p in this case, and say "p is ..." reading outward as
- you follow operator precedence and associativity rules. Since
- & and * have the same precedence and associate right-to-left,
- the statement above is read:
-
- "p is a reference to pointer to void"
-
- Remembering this rule can get you through even the most
- complex declarations, e.g. X &(* a[5][10])(int);
-
- "a is a 5-element array of 10-element arrays of pointer
- to function taking int and returning reference to X"
-
- There's more about this in the c.l.c FAQ.
- --
- Russell Blackadar, russell@mdli.com
-